<script>
import { mapState } from 'vuex'
import AOS from "aos"
import { correctPullDown } from '@/utils/global'
import ChangePage from '@/mixins/ChangePage.vue'
// 初始化动画
// 初始化动画
AOS.init();

export default {
  name: 'SportTeacher',
  // 混入方法，公共方法previousPage，上滑至上一页
  mixins: [ ChangePage ],
  computed: {
    // 动态计算高度
    cssVar() {
      return {
        'height': document.documentElement.clientHeight + 'px'
      }
    }, ...mapState({
      gender: state => state.info.gender,
      annualData: state => state.annualData
    })
  },
  mounted () {
    // 每个页面都要有
    correctPullDown()
  },
  methods: {
    changePage() {
      this.$router.push({
        path: '/library/teacher'
      })
    }
  }
}
</script>
<template>
  <div v-swipeup="changePage" v-swipedown="previousPage">
    <div :class="gender === '1' ? 'teacher-boy' : 'teacher-girl'" :style="cssVar" @click="changePage">
      <div class="teacher-con">
        <div :data-aos="'fade-right'"
             data-aos-easing="ease-in-back"
             data-aos-delay="300"
             data-aos-offset="0"
             data-aos-duration="800"
             id="myText">
          <div v-if="annualData.gymAppointCishu" class="mt-10">
            <div class="mt-10">
              <p>健康的体魄是工作生活的有力保障</p>
              <p>过去一年</p>
              <p>您前往体育馆强身健体</p>
              <p>进行了<span class="data">{{ annualData.gymAppointCishu }}</span> 次的锻炼</p>
              <p>是您对自身健康的珍视</p>
              <p>也是为工作生活续航的有力保障</p>
            </div>
            <br/>
            <div class="mt-10">
              <p>愿新的一年</p>
              <p>您依旧能保持健康</p>
              <p>以饱满的精力</p>
              <p>继续投身于事业之中</p>
            </div>
          </div>
            <!-- 兜底文案 -->
            <div v-if="!annualData.gymAppointCishu" class="mt-10">
              <div class="mt-10">
                <p>健康的体魄</p>
                <p>是工作生活的有力保障</p>
                <p>过去一年</p>
                <p>您一直通过各种方式保持健康</p>
              </div>
              <div class="mt-10">
                <p>无论是通过户外活动增强体质</p>
                <p>还是养成良好的饮食和作息习惯</p>
                <p>您用行动诠释着对生活和工作的热爱</p>
                <p>以饱满的精力</p>
                <p>继续投身于事业之中</p>
              </div>
            </div>
        </div>
      </div>
    </div>
  </div>
</template>
<style scoped>
.teacher-boy {
  background: url("../../assets/images/sport/teacher_boy.jpg") no-repeat;
  background-size: 100% 100%;
}
.teacher-girl {
  background: url("../../assets/images/sport/teacher_girl.jpg") no-repeat;
  background-size: 100% 100%;
}
.teacher-con{
  padding: 20px 20px;
}

p {
  color: #FEFEFE;
}

</style>
